package com.lee.base;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;

import java.io.IOException;

/**
 * @Description TODO
 * @Author winston
 * @DateTime 2022/3/9
 */
public class ConnectionDemo {
    public static void main(String[] args) throws IOException {
        connection();
    }

    private static void connection() throws IOException {
        RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(HttpHost.create("https://elasticsearch-dev.souban.io")));
        boolean ping = client.ping(RequestOptions.DEFAULT);
        System.out.println(ping);
        client.close();
    }
}
